home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_01
/
8n01091b
< prev
next >
Wrap
Text File
|
1990-02-18
|
1KB
|
50 lines
Listing 2
------------------------------------------------------------
#include <stdio.h>
#include <conio.h>
#define XSIZE 50
#define YSIZE 15
char newbuffer[XSIZE * YSIZE * 2]; /* Allow for Attributes */
char oldbuffer[XSIZE * YSIZE * 2];
main()
{
int i, j;
char key_string[15];
/* Get the existing screen area and store it in oldbuffer.
* Subtract 1 from size, since the 1st position is 0.
*/
gettext(5,5,5+XSIZE-1,5+YSIZE-1,oldbuffer);
/* Clear the new window area (newbuffer) */
for (i = 0; i < YSIZE; i++) {
for (j = 0; j < XSIZE*2; j+=2) {
newbuffer[i*XSIZE*2+j] = ' '; /* Blank Space */
newbuffer[i*XSIZE*2+j+1] = '\35'; /* Attribute */
}
}
/* Loop through 10 times */
for (j = 0; j < 10; j++) {
/* Print YSIZE lines */
for (i = 0; i < YSIZE; i++) {
sprintf(key_string,"Value %.3d",i+(j*(int)YSIZE));
puttext_write(1,i,XSIZE,YSIZE,key_string,\
'\35',newbuffer);
}
/* Show it on the screen */
puttext(5,5,5+XSIZE-1,5+YSIZE-1,newbuffer);
delay(500);
}
/* Restore the original screen */
puttext(5,5,5+XSIZE-1,5+YSIZE-1,oldbuffer);
}
------------------------------------------------------------